package org.example.myleet.p523;

import org.example.myleet.Utils.Assert;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class Main {
    public static void main(String[] args) {
        Solution solution = new Solution();
        Assert.isTrue(solution.checkSubarraySum(new int[]{23,2,4,6,7}, 6));
        Assert.isTrue(solution.checkSubarraySum(new int[]{23,2,6,4,7}, 6));
        Assert.isTrue(!solution.checkSubarraySum(new int[]{23,2,6,4,7}, 13));
        Assert.isTrue(solution.checkSubarraySum(new int[]{23,2,4,6,6}, 7));
        Assert.isTrue(solution.checkSubarraySum(new int[]{0,0}, 1));
    }

    private static int[] readExample(String absoluteFilePath) {
        //big example
        BufferedReader reader = null;
        List<Integer> numbers = new ArrayList<>(10000);
        try {
            reader = new BufferedReader(new FileReader(new File(absoluteFilePath)));
            String temp = reader.readLine();
            String[] numberStrings = temp.split(",");
            for (String numberString : numberStrings) {
                numbers.add(Integer.valueOf(numberString));
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (reader != null) {
                try {
                    reader.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
        int[] nums = new int[10000];
        for (int i = 0; i < 10000; ++i) {
            nums[i] = numbers.get(i);
        }
        return nums;
    }
}
